package servlet;

import hadoop.hadooputil;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * @auther 郭天凌
 * @date 2022/3/11
 */
@WebServlet("/demo4")
public class servletdemo4 extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        resp.setContentType("text/html;charset=utf-8");
        req.setCharacterEncoding("utf-8");


        String srcPath = req.getParameter("srcpath");
        String destPath = req.getParameter("destpath");

        hadooputil hadoop= new hadooputil();
        // hdfs 上传文件
        String obj1 = hadoop.hadoopDowload(srcPath,destPath);
        //


        resp.setContentType("text/html;charset=utf-8");
        PrintWriter pw =  resp.getWriter();
        pw.write("<h1>"+  obj1);
    }
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doGet(req,resp);
    }
}
